﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工作任务  <{$smarty.const.WEB_NAME}></title>
	<link rel="stylesheet" type="text/css" href="./skin/default/style.css" />
	<script type="text/javascript" src="./skin/default/comm.js"></script> 
	<script type="text/javascript" src="./skin/default/calendar.js"></script>
	<style type="text/css">
		  body	{font-size:13px;}
	</style>
 </HEAD>

 <BODY>
 	<table width="100%">
 	<tr>
 		<td valign="top" width="100"  >
		   <div class="leftUserList" id="leftUserList">
			 <span class="tit">工作任务</span>
			 <ol>
				<{section name=loop loop=$departmentList}>
				<li> 
					<div onclick="OnWorkPlan(<{$departmentList[loop].id}>)">
						<a href="?q=workManage/viewWorkTask&mode=dept&departmentId=<{$departmentList[loop].id}>"><{$departmentList[loop].name}></a>
					</div>
					<dl class="hidden">
						<{section name=list loop=$userList}>
							<{if $userList[list].departmentId == $departmentList[loop].id}>
								<dt onclick="OnWorkTask(<{$userList[list].id}>)">									
									<a href="?q=workManage/viewWorkTask&mode=user&userId=<{$userList[list].id}>"><{$userList[list].name}></a>
								</dt>
							<{/if}>
						<{/section}>
					</dl>
				</li>
				<{/section}>
			</ol>
		   </div>
		</td>
 	  <td valign="top">
	  <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="font-size:13px;">
		  <tr> 
			<th width="20%" align="center"><a href="?q=workManage/viewWorkTask&mode=dept&departmentId=<{$smarty.session.departmentId}>">查看本部门工作任务</a></th>
			<th width="20%" align="center"><a href="?q=workManage/viewWorkTask&mode=user&userId=<{$smarty.session.id}>">查看本人工作任务</a></th>
			<th width="20%" align="center"><a href="?q=workManage/viewWorkTaskItem&userId=<{$smarty.session.id}>">新增本人工作任务</a></th>
		  </tr>
	  </table>
	  <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="font-size:13px;">
		  <tr> 
			<th width="3%" align="center">编号</th>
			<th width="8%" align="center">创建时间</th>
			<th width="5%" align="center">员工</th>
			<th width="30%" align="center">任务概要</th>
			<th width="7%" align="center">估算工时</th>
			<th width="8%" align="center">开始时间</th>
			<th width="8%" align="center">结束时间</th>
			<th width="7%" align="center">实际工时</th>
			<th width="4%" align="center">返工</th>
			<th width="4%" align="center">警告</th>
			<th width="4%" align="center">得分</th>
			<th width="5%" align="center">状态</th>
			<th width="7%" align="center">操作</th>
		  </tr>
		  <{section name=itm loop=$workTaskList}>
			<{assign var="taskId" value=$workTaskList[itm].id}>
			<{assign var="planItemId" value=$workTaskList[itm].planItemId}>
			<{assign var="createTime" value=$workTaskList[itm].createTime}>
			<{assign var="taskName" value=$workTaskList[itm].taskName}>
			<{assign var="userId" value=$workTaskList[itm].userId}>
			<{assign var="userName" value=$workTaskList[itm].userName}>
			<{assign var="ePlanWorkTime" value=$workTaskList[itm].ePlanWorkTime}>
			<{assign var="mPlanWorkTime" value=$workTaskList[itm].mPlanWorkTime}>
			<{assign var="startTime" value=$workTaskList[itm].startTime}>
			<{assign var="endTime" value=$workTaskList[itm].endTime}>
			<{assign var="eRealWorkTime" value=$workTaskList[itm].eRealWorkTime}>
			<{assign var="mRealWorkTime" value=$workTaskList[itm].mRealWorkTime}>
			<{assign var="repeatWorkTime" value=$workTaskList[itm].repeatWorkTime}>
			<{assign var="warnTimes" value=$workTaskList[itm].warnTimes}>
			<{assign var="score" value=$workTaskList[itm].score}>
			<{assign var="state" value=$workTaskList[itm].state}>
		  <tr>
			<td align="center"><{$taskId}></td>
			<td align="center"><{$createTime}></td>
			<td align="center"><{$userName}></td>
			<td align="left"><a href="?q=workManage/viewWorkTaskItem&taskId=<{$taskId}>"><{$taskName}></a></td>
			<td align="left">
				<{if $userId == $smarty.session.id && $mRealWorkTime == 0 && $eRealWorkTime == 0}>
					<a href="#" onclick="javascript:EPlanWorkTime(<{$taskId}>, <{$ePlanWorkTime}>, '<{$startTime}>', '<{$endTime}>')">员工: <{$ePlanWorkTime}></a>
				<{else}>
					员工: <{$ePlanWorkTime}>
				<{/if}>
				<br>
				<{if $smarty.session.type == 1 && $ePlanWorkTime > 0}>
					<a href="#" onclick="javascript:MPlanWorkTime(<{$taskId}>, <{$userId}>, <{$mPlanWorkTime}>)">主管: <{$mPlanWorkTime}></a>
				<{else}>
					主管: <{$mPlanWorkTime}>
				<{/if}>
			</td>
			<{if $userId == $smarty.session.id && $mRealWorkTime == 0}>
				<{if $eRealWorkTime == 0}>
				<td align="center" onclick="javascript:ShowUpStarttime(<{$taskId}>, '<{$startTime}>', '<{$endTime}>')">
					<{$startTime}>
				</td>
				<{else}>
					<td align="center"><{$startTime}></td>
				<{/if}>
				<td align="center" onclick="javascript:ShowUpEndTime(<{$taskId}>, '<{$startTime}>', '<{$endTime}>')">
					<{$endTime}>
				</td>
			<{else}>
				<td align="center"><{$startTime}></td>
				<td align="center"><{$endTime}></td>
			<{/if}>
			<td align="left">
				<{if $userId == $smarty.session.id && $ePlanWorkTime > 0 && $mRealWorkTime == 0}>
					<a href="#" onclick="javascript:ShowUpERealWorkTime(<{$taskId}>, <{$eRealWorkTime}>)">员工: <{$eRealWorkTime}></a>
				<{else}>
					员工: <{$eRealWorkTime}>
				<{/if}>
				<br>
				<{if $smarty.session.type == 1 && $mPlanWorkTime > 0 && $eRealWorkTime > 0}>
					<a href="#" onclick="javascript:ShowUpMRealWorkTime(<{$taskId}>, <{$userId}>, <{$mRealWorkTime}>)">主管: <{$mRealWorkTime}></a>
				<{else}>
					主管: <{$mRealWorkTime}>
				<{/if}>
			</td>
			<{if $smarty.session.type == 1 && $mRealWorkTime > 0}>
				<td align="center" onclick="javascript:ShowUpRepeatWorkTime(<{$taskId}>, <{$userId}>, <{$repeatWorkTime}>)"><{$repeatWorkTime}></td>
				<td align="center" onclick="javascript:ShowUpWarnTimes(<{$taskId}>, <{$userId}>, <{$warnTimes}>)"><{$warnTimes}></td>
			<{else}>
				<td align="center"><{$repeatWorkTime}></td>
				<td align="center"><{$warnTimes}></td>
			<{/if}>
			<td align="center"><{$score}></td>
			<{if $state == 1}>
				<td align="center">已完成</td>
			<{else}>
				<td align="center">未完成</td>
			<{/if}>
			<td align="center">
				<a href="?q=workManage/viewWorkTaskItem&taskId=<{$taskId}>">评价</a>
				<{if $smarty.session.type == 1}>
					<a href="#" onclick="javascript:GoDeleteUrl(<{$taskId}>)">删除</a>
				<{/if}>
			</td>
		  </tr>
		  <{/section}>
	  </table>

	  <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="font-size:13px;">
		<tr>
		  <form method="post" id="viewWorkTaskByDateId" onsubmit="return CheckQuery()" action="?q=workManage/viewWorkTask">
		  <input type="hidden" name="qtype" value="" id="qtypeId" />
		  <input type="hidden" name="pageAction" value="" id="pageActionId" />
		  
		  <td align="center">
		  	第<{$pageIndex}>页&nbsp&nbsp&nbsp
			<input type="submit" value="上  页" title="显示上一页" class="sub_btn" onclick="javascript:OnPrevPage()" />
			&nbsp&nbsp&nbsp
			<input type="submit" value="下  页" title="显示下一页" class="sub_btn" onclick="javascript:OnNextPage()" />
		  </td>
		  <td align="center">
			本月总工作天数:<{$totalWorkDays}>
		  </td>
		  <td align="center">
		  	<input type="text" width="2" id="yearId" name="year" value="<{$year}>" />
			<input type="text" width="1" id="monthId" name="month" value="<{$month}>" />
			<input type="submit" value="查  询" title="按月查询" class="sub_btn" onclick="javascript:OnMonthQuery()"/>
		  </td>
		  <td align="center">
			<input type="submit" value="上  月" title="显示上一个月" class="sub_btn" onclick="javascript:OnPrevMonthQuery()"/>
			&nbsp&nbsp&nbsp
			<input type="submit" value="下  月" title="显示下一个月" class="sub_btn" onclick="javascript:OnNextMonthQuery()"/>
		  </td>
		  <td align="center">
			<input type="button" value="导  出" title="导出记录" class="sub_btn" />
		  </td>
		  </form>
		</tr>
	  </table>

	  <{if $qUserId > 0 && $userlevel > 0 }>
	  <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="font-size:13px;">
		<tr>
			<td align="center">员工</td>
			<td align="center">级别</td>
			<td align="center">系数</td>
			<td align="center">任务总数</td>
			<td align="center">自估计划天数</td>
			<td align="center">确认计划天数</td>
			<td align="center">自估实际天数</td>
			<td align="center">确认实际天数</td>
			<td align="center">返工数</td>
			<td align="center">警告次数</td>
			<td align="center">总计得分</td>
			<td align="center">工作量</td>
			<td align="center">工作效率</td>
			<td align="center">工作进度</td>
			<td align="center">工作质量</td>
			<td align="center">本月工作绩效</td>
		</tr>
		<tr>
			<td align="center"><{$username}></td>
			<td align="center"><{$userlevel}></td>
			<td align="center"><{$coefficient}></td>
			<td align="center"><{$taskSum}></td>
			<td align="center"><{$selfPlanSum}></td>
			<td align="center"><{$masterPlanSum}></td>
			<td align="center"><{$selfRealSum}></td>
			<td align="center"><{$masterRealSum}></td>
			<td align="center"><{$repeatSum}></td>
			<td align="center"><{$warnSum}></td>
			<td align="center"><{$scoreSum}></td>
			<td align="center"><{$workload|string_format:"%.2f"}></td>
			<td align="center"><{$workefficiency|string_format:"%.2f"}></td>
			<td align="center"><{$workevolve|string_format:"%.2f"}></td>
			<td align="center"><{$workquality|string_format:"%.2f"}></td>
			<td align="center"><{$workKPI|string_format:"%.2f"}></td>
		</tr>
	  </table>
	  <{/if}>
	</td>
	</tr>
	</table>

	<div style="font-size:16px; background:#C0C0C0">
		说明：
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作任务填写规则：
		<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.每个工作任务填写一条记录。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.每个工作任务估算时间不能超过4天，超过则必须把大任务细分成几个小任务；每月不得少于8个任务，任务数量正常值应该在12~20个之间，以上数值超出范围绩效考核系统将自动生成提醒，如遇特殊工作任务不能满足以上条件则需向主管说明情况。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.当月工作任务必须当月填写并完成确认，拖慢提交影响评分结果自负。应该在开始工作任务之前填写好相关工作任务，在完成工作任务之后立即进行确认，最迟必须在完成任务后第二天进行确认。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.实际确认的工作任务总天数不能超过本月额定工作天数。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5.任务概要必须简洁地描述工作任务。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.工作内容和工作过程则必须尽可能详细描述工作任务。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;得分：按时完成得1分，提前或拖慢按0.25天起计，每0.25天增加或减少0.1分。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;返工：返工任务在原项目上追加实际完成时间但不按新任务分配。返工一次扣0.2分。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;警告：警告一次扣0.4分。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作量：主管分配或根据工作内容按实际情况自行分配任务，列明计划工作时间。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作量系数：按员工级别划分，第1级系数为1，第2级系数为1.1，第3级系数为1.2，第4级系数为1.3，第5级系数为1.4。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作效率：按时、按质完成，按时不按质完成，不按时按质完成。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作进度：收到分配任务后，自主安排时间完成。体现个人工作过程自我安排。
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作质量：任务完成的返工率计算。由主管检验，不按质量完成打回返工，返工时间由主管打回起计算。
		<br><br>算法：
		<br>&nbsp;&nbsp;&nbsp;&nbsp;得分=1 + 0.1 * (主管确认的计划完成时间 - 主管确认的实际完成时间) / 0.25 - 返工数 * 0.2 - 警告次数 * 0.4
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作量=100 *（得分/任务数量）*工作量系数*(主管确认的实际工作时间/本月额定工作时间)
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作效率=100 *（主管确认的计划完成时间/本月额定工作时间）*（1-返工率，返工率=返工数/任务数）
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作进度=100 *（1 -（本月额定工作时间-主管确认的实际完成时间）/本月额定工作时间）
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作质量=100 *（任务数/（任务数+返工数））
		<br>&nbsp;&nbsp;&nbsp;&nbsp;工作绩效=( 工作量 + 工作效率 + 工作进度 + 工作质量 ) / 4
	</div>

	  <table id="UpdateEPlanWorkTimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" 
	  	cellpadding="0" class="msg_box driftWindow" 
	  	style="font-size:13px; display:none; width:300px; left:320px; top:100px">
		<form method="post" onsubmit="return CheckEPlanWorkTime()" 
			action="?q=workManage/UpdateEPlanWorkTime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_1' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">估算工时</td>
			<td>
				<input type="text" name="ePlanWorkTime" id="ePlanWorkTime_1" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="UpdateMPlanWorkTimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" 
	  	cellpadding="0" class="msg_box driftWindow" 
	  	style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" onsubmit="return CheckMPlanWorkTime()" 
			action="?q=workManage/UpdateMPlanWorkTime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_2' value="" />
		   <input type="hidden" name="eUserId" id='userId_2' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">估算工时</td>
			<td>
				<input type="text" name="mPlanWorkTime" id="mPlanWorkTime_2" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="updateStarttimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" 
	  	cellpadding="0" class="msg_box driftWindow" 
	  	style="font-size:13px; display:none; width:300px; left:320px; top:150px">
		<form method="post" onsubmit="return CheckStarttime()" 
			action="?q=workManage/UpdateStarttime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_3' value="" />
		   <input type="hidden" name="endtime" id="endtime_3" value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">开始时间</td>
			<td>
				<input type="text" name="starttime" id="starttime_3" value="" 
				class="timeInput" style="margin-left:20px;" onclick="MyCalendar.SetDate(this)" /> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="updateEndtimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" onsubmit="return CheckEndtime()" action="?q=workManage/UpdateEndtime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_4' value="" />
		   <input type="hidden" name="starttime" id="starttime_4" value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">结束时间</td>
			<td>
				<input type="text" name="endtime" id="endtime_4" value="" class="timeInput" style="margin-left:20px;" onclick="MyCalendar.SetDate(this)" /> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="UpdateERealWorkTimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" onsubmit="return CheckERealWorkTime('<{$totalWorkDays}>', '<{$selfRealSum}>')" action="?q=workManage/UpdateERealWorkTime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_5' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">实际工时</td>
			<td>
				<input type="text" name="workTime" id="eRealWorkTime_5" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="UpdateMRealWorkTimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" onsubmit="return CheckMRealWorkTime()" action="?q=workManage/UpdateMRealWorkTime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_6' value="" />
		   <input type="hidden" name="eUserId" id='userId_6' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">实际工时</td>
			<td>
				<input type="text" name="workTime" id="mRealWorkTime_6" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="UpdateRepeatWorkTimeId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" onsubmit="return CheckRepeatWorkTime()" action="?q=workManage/UpdateRepeatWorkTime">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_7' value="" />
		   <input type="hidden" name="userId" id='userId_7' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">返工工时</td>
			<td>
				<input type="text" name="workTime" id="repeatWorkTime_7" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <table id="UpdateWarnTimesId" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:300px; left:320px; top:50px">
		<form method="post" onsubmit="return CheckWarnTimes()" action="?q=workManage/UpdateWarnTimes">	
		 <tr class="tit">
		   <th align="center" colspan="2">修      改</th>
		   <input type="hidden" name="taskId" id='taskId_8' value="" />
		   <input type="hidden" name="userId" id='userId_8' value="" />
		 </tr>
		 <tr>
			<td width="100" align="center">警告次数</td>
			<td>
				<input type="text" name="warnTimes" id="warnTimes_8" value=""/> 
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenTable(this)" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	  <script type="text/javascript">
	  <!--
		// 隐藏表格
		function HiddenTable(obj) {
			do {
				obj = obj.parentElement;
				if( obj != null && obj.nodeName == "TABLE") {
					break;
				}
			}
			while (obj != null);

			obj.style.display = "none";
		}

		// 显示修改员工估算工时
		function EPlanWorkTime(taskId, ePlanWorkTime, starttime, endtime) {
			$('taskId_1').value = taskId;
			$('ePlanWorkTime_1').value = ePlanWorkTime;
			$('UpdateEPlanWorkTimeId').style.display = "block";
		}

		// 校验员工估算工时
		function CheckEPlanWorkTime() {
			var v = $('ePlanWorkTime_1').value;
			v = parseFloat( v );
			if( v <= 0 ) {
				window.alert( "输入非法, 不能小于等于0天" );
				return false;
			} else if( v > 4 ) {
				window.alert( "输入非法, 不能大于4天" );
				return false;
			}
			return true;
		}

		// 显示修改主管估算工时
		function MPlanWorkTime(taskId, userId, mPlanWorkTime) {
			$('taskId_2').value = taskId;
			$('userId_2').value = userId;
			$('mPlanWorkTime_2').value = mPlanWorkTime;
			$('UpdateMPlanWorkTimeId').style.display = "block";
		}

		// 校验主管估算工时
		function CheckMPlanWorkTime() {
			var v = $('mPlanWorkTime_2').value;
			v = parseFloat( v );
			if( v <= 0 ) {
				window.alert( "输入非法, 不能小于等于0天" );
				return false;
			} else if( v > 4 ) {
				window.alert( "输入非法, 不能大于4天" );
				return false;
			}
			return true;
		}

		// 显示修改开始时间
		function ShowUpStarttime(taskId, starttime, endtime) {
			$('taskId_3').value = taskId;
			$('starttime_3').value = starttime;
			$('endtime_3').value = endtime;
			$('updateStarttimeId').style.display = "block";
		}

		// 校验开始时间
		function CheckStarttime() {
			var starttime = $('starttime_3').value;
			if( starttime.trim().length < 8 ) {
				window.alert( "请选择任务开始时间!" );
				return false;
			}

			var endtime = $('endtime_3').value;
			if( endtime.trim().length >= 8 ) {
				if( datecmp( starttime, endtime ) == 1 ) {
					window.alert( "任务开始时间不能大于任务结束时间, 请认真确认!" );
					return false;
				}
			}

			return true;
		}

		// 显示修改结束时间
		function ShowUpEndTime(taskId, starttime, endtime) {
			if( starttime.trim().length < 8 ) {
				window.alert( "请先输入任务开始时间!" );
				return;
			}

			$('taskId_4').value = taskId;
			$('starttime_4').value = starttime;
			$('endtime_4').value = endtime;
			$('updateEndtimeId').style.display = "block";
		}

		// 校验结束时间
		function CheckEndtime() {
			var starttime = $('starttime_4').value;
			if( starttime.trim().length < 8 ) {
				window.alert( "任务开始时间不正确!请先正确输入任务开始时间." );
				return false;
			}

			var endtime = $('endtime_4').value;
			if( endtime.trim().length < 8 ) {
				window.alert( "请选择结束时间!" );
				return false;
			}

			if( datecmp( starttime, endtime ) == 1 ) {
				window.alert( "任务结束时间不能小于任务开始时间, 请认真确认!" );
				return false;
			}

			return true;
		}

		// 比较两个日期大小
		// s1, s2字符串格式: YYYY-MM-DD hh:mm:ss或YYYY-M-D hh:mm:ss, 
		// 如: 2011-05-12 00:00:00, 2011-5-12 00:00:00, 2011-6-1 00:00:00
		// 返回: 
		//	1: s1 > s2
		//  0: s1 == s2
		// -1: s1 < s2
		function datecmp(s1, s2) {
			var t1 = s1.split(" ", 2);
			var t2 = s2.split(" ", 2);
		
			var d1 = t1[0].split("-", 3);
			var d2 = t2[0].split("-", 3);

			var n1 = new Date(d1[0], d1[1], d1[2]);
			var n2 = new Date(d2[0], d2[1], d2[2]);
	
			if( n1.getTime() > n2.getTime() ) {
				return 1;
			} else if( n1.getTime() < n2.getTime() ) {
				return -1;
			}
			
			return 0;
		}

		// 显示修改员工实际工时
		function ShowUpERealWorkTime(taskId, workTime) {
			$('taskId_5').value = taskId;
			$('eRealWorkTime_5').value = workTime;
			$('UpdateERealWorkTimeId').style.display = "block";
		}

		// 校验员工实际工时
		function CheckERealWorkTime(totalWorkDay, totalERealWorkTime) {
			var v = $('eRealWorkTime_5').value;
			v = parseFloat( v );
			if( v < 0 ) {
				window.alert( "输入非法, 不能小于等于0天" );
				return false;
			} else if( v > 4 ) {
				window.alert( "输入非法, 不能大于4天" );
				return false;
			} else if( parseFloat(totalWorkDay) < parseFloat(totalERealWorkTime) + parseFloat(v) ) {
				window.alert( "输入非法, 不能大于本月总工作天数" );
				return false;
			}

			return true;
		}

		// 显示修改主管实际工时
		function ShowUpMRealWorkTime(taskId, userId, workTime) {
			$('taskId_6').value = taskId;
			$('userId_6').value = userId;
			$('mRealWorkTime_6').value = workTime;
			$('UpdateMRealWorkTimeId').style.display = "block";
		}

		// 校验主管实际工时
		function CheckMRealWorkTime() {
			var v = $('mRealWorkTime_6').value;
			v = parseFloat( v );
			if( v < 0 ) {
				window.alert( "输入非法, 不能小于0天" );
				return false;
			} else if( v > 4 ) {
				window.alert( "输入非法, 不能大于4天" );
				return false;
			}
			return true;
		}

		// 显示修改返工工时
		function ShowUpRepeatWorkTime(taskId, userId, workTime)
		{
			$('taskId_7').value = taskId;
			$('userId_7').value = userId;
			$('repeatWorkTime_7').value = workTime;
			$('UpdateRepeatWorkTimeId').style.display = "block";
		}

		// 校验返工工时
		function CheckRepeatWorkTime()
		{
			var v = $('repeatWorkTime_7').value;
			v = parseFloat( v );
			if( v <= 0 ) {
				window.alert( "输入非法" );
				return false;
			}
			return true;
		} 

		// 显示修改警告次数
		function ShowUpWarnTimes(taskId, userId, workTime)
		{
			$('taskId_8').value = taskId;
			$('userId_8').value = userId;
			$('warnTimes_8').value = workTime;
			$('UpdateWarnTimesId').style.display = "block";
		}

		// 校验警告次数
		function CheckWarnTimes()
		{
			var v = $('warnTimes_8').value;
			v = parseFloat( v );
			if( v <= 0 ) {
				window.alert( "输入非法" );
				return false;
			}
			return true;
		}

		// 删除记录
		function GoDeleteUrl(taskId) {
			if( confirm( "你确认要删除吗?" ) ) {
				location.href="?q=workManage/deleteWorkTask&taskId=" + taskId;
			}
		}

		// 校验查询日期
		function CheckQuery() 
		{
			var d = $('querydateId').value;
			if( d.trim().length < 6 ) {
				window.alert( "请选择查询日期!" );
				return false;
			}
			return true;
		}

		// 按月查询设置
		function OnMonthQuery()
		{
			$('qtypeId').value = "curr";
		}

		// 显示上一个月
		function OnPrevMonthQuery()
		{
			$('qtypeId').value = "prev";
		}

		// 显示下一个月
		function OnNextMonthQuery()
		{
			$('qtypeId').value = "next";
		}
		
		// 显示上一页
		function OnPrevPage()
		{
			$('pageActionId').value = "prev";
		}
		
		// 显示下一页
		function OnNextPage()
		{
			$('pageActionId').value = "next";
		}
	  //-->
	  </script>
	</table>
 </BODY>
</HTML>
